package com.ming.javaweb.beans.VO;

import com.ming.javaweb.beans.entity.StudentDO;
import com.ming.javaweb.util.Constants;

import java.util.List;

public class TableVO<T> {

    private List<T> data;
    /**
     * 总共多少条
     */
    private int totalCount;
    /**
     * 透传
     */
    private int pageNow;
//    /**
//     *总共多少页
//     */

    private int pageCount;

    /**
     *透传
     */
    private String studentName;

    /**
     * 总页数
     * @return
     */
    public int getPageCount(){
        int pageCount = 0;
        if (totalCount % Constants.PAGE_SIZE == 0){
            pageCount = totalCount / Constants.PAGE_SIZE;
        }else {
            pageCount = totalCount / Constants.PAGE_SIZE+1;
        }
        return pageCount;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getPageNow() {
        return pageNow;
    }

    public void setPageNow(int pageNow) {
        this.pageNow = pageNow;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }


    @Override
    public String toString() {
        return "TableVO{" +
                "data=" + data +
                ", totalCount=" + totalCount +
                ", pageNow=" + pageNow +
                ", pageCount=" + pageCount +
                ", studentName='" + studentName + '\'' +
                '}';
    }
}
